I'm also getting thhe "You don't have permission to save ..." when I try to "rename" a document within my apps iCloud folder. I'm using the document.save(to: newFileURL, for: .forOverwriting) { ...dance which works fine as long as I'm in the local app's Documents folder.Any hints how to solve that issue for the apps iCloud folder?
Post
Replies
Boosts
Views
Activity
You store the time zone's name (e.g. America/Los_Angeles) in a separate Core Data attribute like "timeZoneName" in your model.
Storing the time zone information:
yourModel.timeZoneName = TimeZone.autoupdatingCurrent.name
From that stored name you can create the appropriate time zone object:
let timeZone = TimeZone(identifier: yourModel.timeZoneName)
Thanks DMG, I was also struggling with this issue using Core Data and also tried various things incl. the @ObservedObject way ... which as you've mentioned results in a crash when deleting the MO.
Creating a separate "ViewModel"-Struct solved that issue and seems like a reasonable solution.